<html>
<head>
<meta charset="UTF-8">
<title>新增目标卡</title>
<link href="../../../css/style.css" rel="stylesheet" type="text/css">
<script language="javascript" src="../../../js/clientSideApp.js"></script>
  <link href="../../../bootstrap-3.3.7-dist/css/bootstrap.css" rel="stylesheet">
  <script src="../../../bootstrap-3.3.7-dist/js/jquery-3.4.1.min.js"></script>
  <script src="../../../bootstrap-3.3.7-dist/js/bootstrap.js"></script>
  <style>
    form {
      margin: 50px;
    }
    button {
      position: relative;
      left: 42%;
    }
    h2 {
      text-align: center;
    }
  </style>
</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<h2>挂号信息表</h2>
<form>
  <div class="form-group">
    <label for="exampleInputEmail1">病人姓名</label>
    <input type="text" class="form-control" id="exampleInputEmail1" name="pname" placeholder="病人姓名">
  </div>
<!--  <div class="form-group">-->
<!--    <label for="exampleInputPassword1">病人年龄</label>-->
<!--    <input type="number" class="form-control" name="page" id="exampleInputPassword1" placeholder="年龄" maxlength="120" minlength="0">-->
<!--  </div>-->
  <div class="form-group">
    <label for="exampleInputIdNum">病人身份证号</label>
    <input type="text" class="form-control" name="pcode" id="exampleInputIdNum" placeholder="身份证号" maxlength="18" onkeyup="this.value=this.value.replace(/[^\d\x\X]/g,'')" >
  </div>
  <!-- name="department.depid"-->
  <label>挂号科室</label>
  <select class="form-control" name="depid">
    <option value="1">内科</option>
    <option value="2">外科</option>
    <option value="3">骨科</option>
  </select>
  <br>
  <!--name="particulars.parchargeitemid"-->
  <label>挂号类别</label>
  <select class="form-control" name="parchargeitemid">
    <option value="1">普通号</option>
    <option value="2">专家号</option>
    <option value="3">急诊号</option>
  </select>
  <div class="form-group">
  性别:
    <label class="radio-inline">
      <input type="radio" name="pgender" id="inlineRadio1" value="男" checked="checked"> 男
    </label>
    <label class="radio-inline">
      <input type="radio" name="pgender" id="inlineRadio2" value="女"> 女
    </label>
  </div>
  <!-- name="patientinformation.patrdate"-->
  <div class="form-group">
    <label for="exampleInputDate">挂号日期</label>
    <input type="date" class="form-control" id="exampleInputDate" name="patrdate" placeholder="请选择日期">
  </div>
  <button type="button" class="btn btn-primary btn-lg">确认</button> &nbsp
  <button type="button" class="btn btn-primary btn-lg">取消</button>
</form>

<script>
  $(document).ready(function () {
    var time = new Date();
    var day = ("0" + time.getDate()).slice(-2);
    var month = ("0" + (time.getMonth() + 1)).slice(-2);
    var today = time.getFullYear() + "-" + (month) + "-" + (day);
    $("input[name='patrdate']").val(today);
  })

  $("button:first").on("click",function () {
        $.ajax({
          url: "http://localhost:10012/feign/add",
          type: "post",
          headers: {
            Accept: "application/json; charset=utf-8",
            Authorization: location.href.split("=")[1]
          },
          data:$("form").serialize(),
          dataType: "json",
          success: function (data) {
            if(data.code==200) {
              alert("添加成功！");
            }else{
              alert("添加失败！");
            }
          }
        });
  })
</script>
</body>
</html>
